#include<stdio.h>
int main()
{
	int arr1[4] = { 0 };
	int arr2[4] = { 0 };
	int i = 0;
	int temp = 0;
	for (i = 0; i < 4; i++)
	{
		scanf("%d", &arr1[i]);

	}
	for (i = 0; i < 4; i++)
	{
	    scanf("%d", &arr2[i]);
    }
	for (i = 0; i < 4; i++)
	{
		temp = arr1[i];
		arr1[i] = arr2[i];
		arr2[i] = temp;
		printf("%d", arr1[i]);
	}
	printf("\n");
	for (i = 0; i < 4; i++)
	{
		
		printf("%d", arr2[i]);
	}
	return 0;
}
